package com.ypj.rpc;

import com.ypj.rpc.api.ByeService;
import com.ypj.rpc.api.HelloObject;
import com.ypj.rpc.api.HelloService;
import com.ypj.rpc.transport.RpcClient;
import com.ypj.rpc.transport.RpcClientProxy;
import com.ypj.rpc.transport.netty.client.NettyClient;

public class NettyTestClient {
    public static void main(String[] args) {
        RpcClient client=new NettyClient();
        RpcClientProxy proxy=new RpcClientProxy(client);
        HelloService helloService=proxy.getProxy(HelloService.class);
        HelloObject object=new HelloObject(12,"This is a message!");
        String res=helloService.hello(object);


        ByeService byeService=proxy.getProxy(ByeService.class);
        System.out.println(res);
        System.out.println(byeService.bye("Netty"));
    }
}
